package com.kaili.tms.controller.web.v1;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.common.response.RestStatus;
import com.kaili.tms.pojo.dto.SchedulingSearchQueryDTO;
import com.kaili.tms.pojo.vo.RouteInfoVO;
import com.kaili.tms.pojo.vo.SchedulingSearchVO;
import com.kaili.tms.service.SchedulingSearchService;
import com.kaili.tms.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Desc: 排班查询
 * @author: zengshuai
 * @Time: 19-2-20 上午9:57
 * @Copyright: © 2018 杭州凯立通信有限公司 版权所有
 * @Warning: 本内容仅限于公司内部传阅, 禁止外泄或用于其它商业目的
 */
@RestController
@ApiVersion(1)
@RequestMapping("/{api_version}")
@Api(tags = "排班查询", description = "排班查询API")
public class SchedulingSearchController {

    @Autowired
    private SchedulingSearchService schedulingSearchService;

    @GetMapping("/scheduling")
    @ApiOperation(value = "排班查询")
    public Page<SchedulingSearchVO> queryScheduling(@ModelAttribute SchedulingSearchQueryDTO queryDTO){
        Page<SchedulingSearchVO> pager = new Page<>(queryDTO.getPage(),queryDTO.getPageSize());
        return schedulingSearchService.queryScheduling(pager,queryDTO);
    }

    @GetMapping("/queryRouteByCarTrainNum/{trainNum}")
    @ApiOperation(value = "车次编号带出车线编码和始发地和目的地")
    public List<RouteInfoVO> queryRouteByCarTrainNum(@PathVariable Long trainNum){
        return schedulingSearchService.queryRouteByCarTrainNum(trainNum);
    }

    @GetMapping("/queryCityByRouteCode/{routeCode}")
    @ApiOperation(value = "车线编号带出始发地和目的地")
    public List<RouteInfoVO> queryCityByRouteCode(@PathVariable String routeCode){
        return schedulingSearchService.queryCityByRouteCode(routeCode);
    }


}
